package com.hxd.otc.module.convenience.bean;

import com.hxd.otc.common.enums.ConvenienceBusinessTypeEnum;
import com.hxd.otc.utils.StringUtil;

import java.io.Serializable;

/**
 * Created by lzy on 2018/12/12 0012.
 * description ${订单信息}
 */
public class OrderInfoBean implements Serializable {
    private String goodsId;          //商品Id（业务类型为话费，视频卡，油卡，必传）
    private String moduleId;         //板块Id：（业务类型为水费电费，必传）
    private String itemId;           //水费电费缴费itemId（业务类型为水费电费，必传）
    private String realSymbol;       //支付币种
    private String rechargeAccount;  //缴费卡号
    private String itemNum;          //水费金额（业务类型为水费电费，必传）
    private String gasCardTel;       //持卡人手机号（业务类型为油卡，必传）
    private String gasCardName;      //持卡人姓名（业务类型为油卡，必传）
    private String billCycle;        //账期，查询账户信息若有返回（billCycle字段）则必须要传入，否则充值失败。（业务类型为水费电费，选传）
    private String contractNo;       //合同号（除江苏地区，其他地区需要上传合同编号），千米移动货源必需，普通外挂通过与电信翼支付通道不需要传入（业务类型为水费电费，选传）
    private String address;          //缴费地址（业务类型为水费电费，必传）
    private String priceUnit = "CNY";          //法币单位
    private String code;            //验证码

    private String goodsName;   //本地字段：订单信息描述
    private double volume;      //本地字段：虚拟币标价
    private String remark;      //备注
    private String modelTitle;   //支付完成页面的title
    private String sellPrice;    //本地字段：当前商品的法币价格

    private ConvenienceBusinessTypeEnum businessType;//便民服务类型

    public String getPriceUnit() {
        return priceUnit;
    }

    public void setPriceUnit(String priceUnit) {
        this.priceUnit = priceUnit;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getModelTitle() {
        return modelTitle;
    }

    public void setModelTitle(String modelTitle) {
        this.modelTitle = modelTitle;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(String goodsId) {
        this.goodsId = goodsId;
    }

    public String getModuleId() {
        return moduleId;
    }

    public void setModuleId(String moduleId) {
        this.moduleId = moduleId;
    }

    public String getItemId() {
        return itemId;
    }

    public void setItemId(String itemId) {
        this.itemId = itemId;
    }

    public String getRealSymbol() {
        return StringUtil.emptyIfNull(realSymbol);
    }

    public void setRealSymbol(String realSymbol) {
        this.realSymbol = realSymbol;
    }

    public String getRechargeAccount() {
        return rechargeAccount;
    }

    public void setRechargeAccount(String rechargeAccount) {
        this.rechargeAccount = rechargeAccount;
    }

    public String getItemNum() {
        return itemNum;
    }

    public void setItemNum(String itemNum) {
        this.itemNum = itemNum;
    }

    public String getGasCardTel() {
        return gasCardTel;
    }

    public void setGasCardTel(String gasCardTel) {
        this.gasCardTel = gasCardTel;
    }

    public String getGasCardName() {
        return gasCardName;
    }

    public void setGasCardName(String gasCardName) {
        this.gasCardName = gasCardName;
    }

    public String getBillCycle() {
        return billCycle;
    }

    public void setBillCycle(String billCycle) {
        this.billCycle = billCycle;
    }

    public String getContractNo() {
        return contractNo;
    }

    public void setContractNo(String contractNo) {
        this.contractNo = contractNo;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public double getVolume() {
        return volume;
    }

    public void setVolume(double volume) {
        this.volume = volume;
    }

    public ConvenienceBusinessTypeEnum getBusinessType() {
        return businessType;
    }

    public void setBusinessType(ConvenienceBusinessTypeEnum businessType) {
        this.businessType = businessType;
    }

    public String getSellPrice() {
        return sellPrice;
    }

    public void setSellPrice(String sellPrice) {
        this.sellPrice = sellPrice;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public static OrderInfoBean createPrepaidRechargeOrder(String phoneNumber, NorGoodsBean goodsBean,
                                                           ConvenienceBusinessTypeEnum businessType, String modelTitle) {
        OrderInfoBean orderInfoBean = new OrderInfoBean();
        orderInfoBean.setRechargeAccount(phoneNumber);
        orderInfoBean.setGoodsId(goodsBean.getId());
        orderInfoBean.setRealSymbol(goodsBean.getSymbol());
        orderInfoBean.setVolume(goodsBean.getVolume());
        orderInfoBean.setGoodsName(goodsBean.getGoodsName());
        orderInfoBean.setItemId(goodsBean.getGoodsCode());
        orderInfoBean.setBusinessType(businessType);
        orderInfoBean.setModelTitle(modelTitle);
        orderInfoBean.setPriceUnit(goodsBean.getPriceUnit());
        orderInfoBean.setSellPrice(goodsBean.getSellPrice() + "");
        return orderInfoBean;
    }

    public static OrderInfoBean createVideoServiceRecharge(String videoAccount, NorGoodsBean goodsBean,
                                                           ConvenienceBusinessTypeEnum businessType, String title, String priceUnit) {
        OrderInfoBean orderInfoBean = new OrderInfoBean();
        orderInfoBean.setRechargeAccount(videoAccount);
        orderInfoBean.setGoodsId(goodsBean.getId());
        orderInfoBean.setRealSymbol(goodsBean.getSymbol());
        orderInfoBean.setVolume(goodsBean.getVolume());
        orderInfoBean.setGoodsName(goodsBean.getGoodsName());
        orderInfoBean.setBusinessType(businessType);
        orderInfoBean.setModelTitle(title);
        orderInfoBean.setPriceUnit(priceUnit);
        orderInfoBean.setSellPrice(goodsBean.getSellPrice() + "");
        return orderInfoBean;
    }

    @Override
    public String toString() {
        return "OrderInfoBean{" +
                "goodsId='" + goodsId + '\'' +
                ", moduleId='" + moduleId + '\'' +
                ", itemId='" + itemId + '\'' +
                ", realSymbol='" + realSymbol + '\'' +
                ", rechargeAccount='" + rechargeAccount + '\'' +
                ", itemNum='" + itemNum + '\'' +
                ", gasCardTel='" + gasCardTel + '\'' +
                ", gasCardName='" + gasCardName + '\'' +
                ", billCycle='" + billCycle + '\'' +
                ", contractNo='" + contractNo + '\'' +
                ", goodsName='" + goodsName + '\'' +
                ", volume='" + volume + '\'' +
                ", businessType='" + businessType + '\'' +
                ", sellPrice='" + sellPrice + '\'' +
                '}';
    }
}
